// 使用节点宽高按照 实际分辨率/设计分辨率 中最大的值进行缩放
import { menu } from "../../decorator";

const { ccclass, property } = cc._decorator;

@ccclass
@menu(__filename)
export default class nodeScale extends cc.Component {
    onLoad() {
        // 设计分辨率
        let drSize = cc.view.getDesignResolutionSize();
        // 实际分辨率
        let winSize = cc.winSize;

        let scaleX = winSize.width / drSize.width;
        let scaleY = winSize.height / drSize.height;
        let scale = Math.max(scaleX, scaleY);
        if (scale > 1) {
            this.node.scale = scale;
        }
    }
}